﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demos.DesignPatterns._17_命令模式
{
    /// <summary>
    /// 调用者：遥控器
    /// </summary>
    public class RemoteControl
    {
        private ICommand _onCommand;

        public void SetCommand(ICommand command)
        {
            _onCommand = command;   
        }

        public void ExecuteCommand()
        {
            _onCommand.Execute();
        }

        public void CancelCommand()
        {
            _onCommand.Undo();
        }


    }
}
